/*****************************************************************************
 *
 *                      HUSONG PROPRIETARY INFORMATION
 *
 *          The information contained herein is proprietary to HUSONG
 *           and shall not be reproduced or disclosed in whole or in part
 *                    or used for any design or manufacture
 *              without direct written authorization from HUSONG.
 *
 *            Copyright (c) 2015 by HUSONG.  All rights reserved.
 *
 *****************************************************************************/
package com.broker.consumer.controller;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import me.send.broker.entity.User;
import me.send.broker.entity.base.ReturnJsonBean;
import me.send.broker.enums.AuthodType;
import me.send.broker.pojo.UserEvaluateBean;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.broker.consumer.controller.base.BaseController;

/**
 * @author maxmin
 *
 * @date 2015年8月25日 下午4:13:02
 */
@Controller
@RequestMapping(value = "/user")
public class UserController extends BaseController {

	/**
	 * 获取用户信息
	 * @param userid
	 * @param devicenumber
	 * @return
	 * @author maxmin
	 * @date 2015年8月25日下午4:23:33
	 */
	@RequestMapping(value = "/detial")
	@ResponseBody
	public ReturnJsonBean userDetial(int userid,String devicenumber) {
		ReturnJsonBean rb = new ReturnJsonBean();
		try {
			User user = userService.getUserInfoById(userid);
			List<UserEvaluateBean> evaluates = userEvaluateService.getEvaluates(userid);
			Map<String, Object> map = new HashMap<String, Object>();
			map.put("user", user);
			map.put("evaluates", evaluates);
			rb.setDatas(map);
			rb.setCode(ReturnJsonBean.SUCCESS);
			rb.setMessage(ReturnJsonBean.SUCCESS_STR);
		} catch (Exception e) {
			saveException(AuthodType.tangjianglong.getName(), "UserController", "userDetial()", e);
			e.printStackTrace();
		}
		return rb;
	}
}
